function timeago(time) {
    var timestamp = Date.parse(time.replace(/-/gi, '/')) / 1000; // 兼容iOS Safari时间格式

    var mistiming = Math.round((new Date().getTime() / 1000 - timestamp) / 60);
    if (mistiming < 60) {
        return mistiming + '分钟前';
    }
    var timing = Math.round(mistiming / 60);
    if (timing < 24) {
        return timing + '小时前';
    }
    var timingday = Math.round(timing / 24);
    if (timingday < 30) {
        return timingday + '天前';
    } else if (timingday > 30 && timingday < 365) {
        return Math.round(timingday / 30) + '个月前';
    } else {
        return Math.round(timingday / 365) + '年前';
    }
}

timeago((new Date(1691377108511)).toLocaleString())